//
//  ZKVSubscribeCell.m
//  ZAKER
//
//  Created by Anyfish002 on 16/2/17.
//  Copyright © 2016年 yaohongchao. All rights reserved.
//

#import "ZKVSubscribeCell.h"

#define Margin 30

@interface ZKVSubscribeCell()

@property (nonatomic,weak) UIImageView *imgV;
@property (nonatomic,weak) UILabel     *lblTitle;
@property (nonatomic,weak) UIImageView *imgVSelect;


@end

@implementation ZKVSubscribeCell

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if(self){
        [self setup];
    }
    return self;
}

-(void)setup{
    self.backgroundColor = [UIColor whiteColor];
    self.layer.borderWidth=0.5;
    self.layer.borderColor=[UIColor colorWithHexString:@"eeeeee"].CGColor;
    UIImageView *imgV = [[UIImageView alloc]init];
    imgV.backgroundColor = [UIColor lightGrayColor];
    [self.contentView addSubview:imgV];
    self.imgV = imgV;
    WS(weakSelf);
    UIEdgeInsets padding = UIEdgeInsetsMake(Margin, Margin, Margin, Margin);
    [imgV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(weakSelf).with.insets(padding);
    }];
    
    UILabel *lblTitle = [[UILabel alloc]init];
    lblTitle.backgroundColor = [UIColor lightGrayColor];
    [self.contentView addSubview:lblTitle];
    lblTitle.font=[UIFont systemFontOfSize:15];
    lblTitle.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:lblTitle];
    [lblTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(imgV.mas_bottom).offset(5);
        make.right.equalTo(weakSelf).offset(-10);
        make.left.equalTo(weakSelf).offset(10);
        make.height.mas_equalTo(15);
    }];
    
    UIImageView *imgVSelect = [[UIImageView alloc]init];
    imgVSelect.backgroundColor = [UIColor lightGrayColor];
    [self.contentView addSubview:imgVSelect];
    self.imgVSelect = imgVSelect;
    [imgVSelect mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.mas_top).offset(8);
        make.right.equalTo(weakSelf.mas_right).offset(-8);
        make.left.equalTo(weakSelf.mas_right).offset(-20);
        make.height.mas_equalTo(12);
    }];
    
}

@end

@implementation ZKVSubscribeHeader

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if(self){
        SDCycleScrollView *scrollView = [[SDCycleScrollView alloc]init];
        [self addSubview:scrollView];
        WS(weakSelf);
        [scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.top.equalTo(weakSelf);
        }];
        self.scrollView = scrollView;
    }
    return self;
}

@end
